package com.samsung.utils.phone.helpers;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.samsung.utils.phone.R;

import android.content.Context;

public class HtmlHelper {
	
	
	
	public static String HTMLHeader = 
			"<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"/>";
	public static String TABLEHeader ="<table border=\"3\" cellpadding=\"1\" cellspacing=\"1\">";
	
	public static String getHTML(String body,Context context){
		String str ="<html>";		
		str+="<head><title>Header</title>";
		str+= readRawTextFile(context, R.raw.style1); //TableStyle;
		str+="</head>";		
		str+="<body>";
		str+=body;
		str+="</body>";
		str+="</html>";
		return str;
	}
	 public static String readRawTextFile(Context ctx, int resId)
     {
          InputStream inputStream = ctx.getResources().openRawResource(resId);

             InputStreamReader inputreader = new InputStreamReader(inputStream);
             BufferedReader buffreader = new BufferedReader(inputreader);
              String line;
              StringBuilder text = new StringBuilder();

              try {
                while (( line = buffreader.readLine()) != null) {
                    text.append(line);
                    text.append('\n');
                  }
            } catch (IOException e) {
                return null;
            }
              return text.toString();
     }

}
